<?php
namespace Core\Application;

use Library\IO\File;

/**
 * Represents a module. This class cannot be inherited
 * @namespace Core\Application
 * @author Raphael DE FREITAS (RaphyTheGeek@gmail.com)
 * @version 1.0
 *
 */
final class Module
{
	/**
	 * Contains the name of the module.
	 * @var string
	 * @see getName
	 */
	protected $_Name = null;
	
	/**
	 * Initializes a new instance of the Module class with the module name specified.
	 * @param string $name Name of this module.
	 */
	public function __construct($name) {
		$this->_Name = strtolower($name);
	}
	
	/**
	 * Obtains the name of this module.
	 * @return string
	 */
	public function getName() {
		return $this->_Name;
	}
	
	/**
	 * Obtains the root path of this module.
	 * @return string The name of this module.
	 */
	public function getRootPath() {
		return ROOT.'modules/'.$this->_Name.'/';
	}
	
	/**
	 * Get the value that indicates if this module has an independencies file.
	 * @return boolean TRUE if the file exists; otherwise, FALSE;
	 */
	public function hasDependenciesFile() {
		return File::exists($this->getDependenciesFile());
	}
	
	/**
	 * Obtains the path of the dependencies file of this module.
	 * @return string
	 */
	public function getDependenciesFile() {
		return $this->getRootPath().'dependencies.xml';
	}
	
	/**
	 * Get the value that indicates if this module has a routes file.
	 * @return boolean TRUE if the file exists; otherwise, FALSE;
	 */
	public function hasRoutesFile() {
		return File::exists($this->getRoutesFile());
	}
	
	/**
	 * Obtains the path of the routes file of this module.
	 * @return string
	 */
	public function getRoutesFile() {
		return $this->getRootPath().'routes.xml';
	}
	
	/**
	 * Get the value that indicates if this module has a configuration file.
	 * @return boolean TRUE if the file exists; otherwise, FALSE;
	 */
	public function hasConfigurationFile() {
		return File::exists($this->getConfigurationFile());
	}
	
	/**
	 * Obtains the path of the configuration file of this module.
	 * @return string
	 */
	public function getConfigurationFile() {
		return $this->getRootPath().'configuration.xml';
	}

	/**
	 * Obtains the controllers path of this module.
	 * @return string The controllers path of this module.
	 */
	public function getControllersPath() {
		return $this->getRootPath().'controllers/';
	}
	
	/**
	 * Obtains the models path of this module.
	 * @return string The models path of this module.
	 */
	public function getModelsPath() {
		return $this->getRootPath().'models/';
	}
	
	/**
	 * Obtains the templates path of this module.
	 * @return string The templates path of this module.
	 */
	public function getTemplatesPath() {
		return $this->getRootPath().'templates/';
	}
	
	/**
	 * Obtains the styles path of this module.
	 * @return string The styles path of this module.
	 */
	public function getStylesPath() {
		return $this->getRootPath().'styles/';
	}
	
	/**
	 * Obtains the scripts path of this module.
	 * @return string The scripts path of this module.
	 */
	public function getScriptsPath() {
		return $this->getRootPath().'scripts/';
	}
	
	/**
	 * Obtains the langs path of this module.
	 * @return string The langs path of this module.
	 */
	public function getLangsPath() {
		return $this->getRootPath().'langs/';
	}
	
	/**
	 * Obtains the images path of this module.
	 * @return string The images path of this module.
	 */
	public function getImagesPath() {
		return $this->getRootPath().'images/';
	}
	
	
}
?>